﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows.Data;
using NIPO.Plugins;

namespace NIPOStarterWPF.Converters
{

    [ValueConversion(typeof(PlugInType), typeof(string))]
    internal class TypeToImageConverter : IValueConverter
    {
        #region IValueConverter Members

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if(value is Plugin)
            {
                switch(Plugin.GetType(value.GetType()))
                {
                    case PlugInType.Input:
                        return "/Images/input.png";
                    case PlugInType.Processing:
                        return "/Images/processing.png";
                    case PlugInType.Output:
                        return "/Images/output.png";
                    case PlugInType.Observer:
                        return "/Images/observer.png";
                    case PlugInType.Service:
                        return "/Images/service.png";
                    default:
                        return "/Images/plugin.png";
                }
            }
            return string.Empty;
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
